<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>hello</title>
    <script type="text/javascript">
        function getUsers() {
            let xhr = new XMLHttpRequest(),
                method = "POST",url = "http://127.0.0.1/getUsers";
            xhr.open(method,url,false)
            xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded")
            xhr.onreadystatechange = function (){
                let XMLHttpReq = xhr;
                if(XMLHttpReq.readyState === XMLHttpReq.DONE){
                    if(XMLHttpReq.status === 200){
                        let data = XMLHttpReq.responseText;
                        alert(data);
                    }else {
                        alert("error")
                    }

                }else {
                    alert("error")
                }
            }


        }
    </script>
</head>
<body>

<h1 align="center">hello 主页面</h1>
    <button value="获取用户" id="getUsers" onclick="getUsers()">获取用户</button>
</body>
</html>